#include "cnpipe_actions.h"
#include "cnpipe_actionsofdisplayingshapes.h"
#include "cnpipe_pipeline.h"
#include "cnpipe_realpipe.h"
#include "cnpipe_piperangedefiner.h"

#include "scene/wsyperspectivecamera.h"
#include "scene/wsyscene.h"

#include <QDebug>

void CNPIPE_actions::showPipeline() {
    qDebug() << "显示管道路径";
    CNPIPE_pipeline *pipeLine = (CNPIPE_pipeline *)parent->getPipeLine();
    pipeLine->showPipeLine();

    CNPIPE_pipeRangeDefiner *rd = (CNPIPE_pipeRangeDefiner *)parent->getPipeRangeDefiner();
    WSYScene *scene = (WSYScene *)parent->getScene();

    WSYPerspectiveCamera *camera = (WSYPerspectiveCamera *)scene->getCamera();

    Vertex3D *cameraPosition = rd->getDefaultCameraPosition();
    Vertex3D *lookAt = rd->getDefaultLookAtVertex();
    lookAt->printSinglePoint("LookAt");

    camera->setPosition(cameraPosition->getX(), cameraPosition->getY(), cameraPosition->getZ());
    camera->setLookAt(lookAt->getX(), lookAt->getY(), lookAt->getZ());
    camera->setFar(10000);

    scene->removeAllObject();
    scene->addPipeLine(pipeLine->getPipeline());
};

void CNPIPE_actions::showRealPipe() {
    qDebug() << "显示实体管道";
    CNPIPE_realPipe *realPipe = (CNPIPE_realPipe *)parent->getRealPipe();
    realPipe->showRealPipe();
}

